#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
	int n;
	cin >> n;

	vector<int> nums(n);
	for (int i = 0; i < n; i++) {
		cin >> nums[i];
	}

	vector<int> dp(n, 1); // 初始化 dp 数组为 1

	for (int i = 1; i < n; i++) {
		for (int j = 0; j < i; j++) {
			if (nums[i] > nums[j]) {
				dp[i] = max(dp[i], dp[j] + 1);

			}
//			cout << i << " " << j << " " << dp[i] << endl;// WA 忘记把调试去掉


		}
	}

	int maxLen = *max_element(dp.begin(), dp.end()); // 找到最大值

	cout << maxLen << endl;

	return 0;
}
